package com.slz3.business.module.messageManagement.mesType.steward;

import com.slz3.business.module.messageManagement.mesType.domain.MesType;
import com.slz3.business.module.messageManagement.mesType.domain.MesTypeCondition;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Component
public class MesTypeResponse {

    @Resource
    private MesTypeResController mesTypeResController;

    public Mono<ServerResponse> add(ServerRequest req) {
        return req.bodyToMono(MesType.class).flatMap(mesType ->
                mesTypeResController.add(req, mesType)
        );
    }

    public Mono<ServerResponse> delete(ServerRequest req) {
        return req.bodyToMono(MesTypeCondition.class).flatMap(mesTypeCondition ->
                mesTypeResController.delete(req, mesTypeCondition)
        );
    }

    public Mono<ServerResponse> modify(ServerRequest req) {
        return req.bodyToMono(MesType.class).flatMap(mesType ->
                mesTypeResController.modify(req, mesType)
        );
    }


    public Mono<ServerResponse> list(ServerRequest req) {
        return mesTypeResController.list(req);
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        return mesTypeResController.info(req);
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        return mesTypeResController.choice(req);
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req) {
        return req.bodyToMono(MesTypeCondition.class).flatMap(mesTypeCondition ->
                mesTypeResController.auditSubmit(req, mesTypeCondition)
        );
    }

    public Mono<ServerResponse> audit(ServerRequest req) {
        return req.bodyToMono(MesTypeCondition.class).flatMap(mesTypeCondition ->
                mesTypeResController.audit(req, mesTypeCondition)
        );
    }

    public Mono<ServerResponse> auditReject(ServerRequest req) {
        return req.bodyToMono(MesTypeCondition.class).flatMap(mesTypeCondition ->
                mesTypeResController.auditReject(req, mesTypeCondition)
        );
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req) {
        return req.bodyToMono(MesTypeCondition.class).flatMap(mesTypeCondition ->
                mesTypeResController.usingEnable(req, mesTypeCondition)
        );
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req) {
        return req.bodyToMono(MesTypeCondition.class).flatMap(mesTypeCondition ->
                mesTypeResController.usingDisable(req, mesTypeCondition)
        );
    }

}
